package com.meihua.pickerviewlibrary;

import android.content.Context;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by liming on 2017/10/19.
 */

@Deprecated
public class SicknessPickerView  extends OptionsPickerView<String> {
    // 生病周期集合
    private ArrayList<Map<String, String>> mRelative = new ArrayList<>();

    public SicknessPickerView(Context context, List<String> cycleList) {
        super(context);
        initRelatives(cycleList);
    }

    private void initRelatives(List<String> cycleList) {
        for (String cycle : cycleList) {
            int indexOf = cycleList.indexOf(cycle);
            Map<String, String> map = new HashMap<>();
            map.put("area_name",cycle);
            map.put("area_id",(indexOf+1)+"");
            mRelative.add(map);
        }
        setTitle("选择生病周期");
        setPicker(mRelative);
        setCyclic(false);
        setSelectOptions(0);
        setOnOptionsSelectListener(new OnOptionsSelectListener() {
            @Override
            public void onOptionsSelect(int option1, int option2, int option3) {
                if (mOnRelativeMoreListener!=null){
                    mRelative.get(option1);
                    mOnRelativeMoreListener.onRelaviteSelectMore(mRelative.get(option1).get("area_name"), option1+1);
                }
            }
        });

    }

    private OnRelativeMoreListener mOnRelativeMoreListener;

    public void setmOnRelativeMoreListener(OnRelativeMoreListener mOnRelativeMoreListener) {
        this.mOnRelativeMoreListener = mOnRelativeMoreListener;
    }

    public interface OnRelativeMoreListener {
        void onRelaviteSelectMore(String Relatives, int position);
    }
}

